﻿using System;
using Autodesk.Revit.DB;

namespace FetchDataCompare
{
	public class BoundingBoxGeoObject : GeoObjectBase
	{
		public BoundingBoxGeoObject(Element inputElement)
		{
			base.GeoObjType = EGeoObjectType.eBoudingBoxObj;
			this.InitDataByElement(inputElement);
		}

		public override void InitDataByElement(Element inputElement)
		{
			try
			{
				BoundingBoxXYZ boundingBoxXYZ = inputElement.get_BoundingBox(null);
				XYZ xyz = boundingBoxXYZ.Min + this.minOffset;
				XYZ xyz2 = boundingBoxXYZ.Max + this.maxOffset;
				XYZ xyz3 = xyz;
				XYZ rightBottom = new XYZ(xyz2.X, xyz.Y, xyz3.Z);
				XYZ leftTop = new XYZ(xyz.X, xyz2.Y, xyz3.Z);
				XYZ rightTop = new XYZ(xyz2.X, xyz2.Y, xyz3.Z);
				base.BoundingRect.LeftBottom = xyz3;
				base.BoundingRect.RightBottom = rightBottom;
				base.BoundingRect.LeftTop = leftTop;
				base.BoundingRect.RightTop = rightTop;
			}
			catch (Exception)
			{
				int integerValue = inputElement.Id.IntegerValue;
			}
		}

		public override bool Equals(object obj)
		{
			return base.Equals(obj);
		}

		private XYZ minOffset = new XYZ(-0.032808398950131233, -0.032808398950131233, -0.032808398950131233);

		private XYZ maxOffset = new XYZ(0.032808398950131233, 0.032808398950131233, 0.032808398950131233);
	}
}
